-
Notifications
You must be signed in to change notification settings - Fork 297
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Do not use Uris to uniquely identify Server Handles (1) #13540
Conversation
84f9c10
to
4fe028c
Compare
public readonly handle: string, | ||
public readonly extensionId: string, | ||
public readonly serverId: string | ||
public readonly serverHandle: { extensionId: string; id: string; handle: string }, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Handle Id and Handle are not unique, two extensions could have the same two values.
@@ -249,37 +249,38 @@ export abstract class DataScienceErrorHandler implements IDataScienceErrorHandle | |||
error: RemoteJupyterServerConnectionError, | |||
errorContext?: KernelAction | |||
) { | |||
const info = await this.serverUriStorage.get(error.serverId); | |||
const info = await this.serverUriStorage.get(error.serverHandle); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Consistently use Serverhandle everwhere instead of generating an id called serverId
and passing that around.
private getStateKey(serverId: string) { | ||
return `LAST_EXECUTED_CELL_${serverId}`; | ||
private async getStateKey(serverHandle: JupyterServerProviderHandle) { | ||
return `LAST_EXECUTED_CELL_${await computeServerId(serverHandle)}`; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We have left this for backwards compatibility, computeServerid is not used in most places,
but this is an exception as we have stored state in older versions of extension and we should preserve that.
@@ -533,10 +537,9 @@ export class JupyterPasswordConnect implements IJupyterPasswordConnect { | |||
* When URIs are removed from the server list also remove them from | |||
*/ | |||
private onDidRemoveUris(uriEntries: IJupyterServerUriEntry[]) { | |||
uriEntries.forEach((uriEntry) => { | |||
const newUrl = addTrailingSlash(uriEntry.uri); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This was a bug, using Uri was never correct.
sendKernelTelemetry(this); | ||
} | ||
public static create(options: { | ||
public static async create(options: { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
In order to preserve the MRU for remote kernels, we must still generate the serverId, and thats an async function.
Hence this method is now async.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
These are the only two places we now use this (old) computeServerId
4455605
to
c86cdf5
Compare
} | ||
public async getAll(): Promise<IJupyterServerUriEntry[]> { | ||
if (this.lastSavedList) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This caching was unnecessary, and a likely spot for bugs.
* Unique ID using a hash of the full uri | ||
*/ | ||
serverId: string; | ||
uri?: string; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This property is now deprecated, it had a number of meanings in different contexts
Hence very buggy
afa2c48
to
cbfa7fb
Compare
cbfa7fb
to
a8d5c1a
Compare
a8d5c1a
to
c37e3c0
Compare
For #12832
Addresses Ambiguous Uri, Url, ServerId